using System;
using Glue;
using Xunit;

namespace GlueTests.AutoRelaterTests
{
    public class When_automatically_relation_properties_of_different_types
    {
        private readonly Mapping<DomainPerson, GuiPerson> mapping;

        public class DomainPerson
        {
            public int Id { get; set; }
        }

        public class GuiPerson
        {
            public String Id { get; set; }
        }
        public When_automatically_relation_properties_of_different_types()
        {
            mapping = new Mapping<DomainPerson, GuiPerson>();
        }

        [Fact]
        public void Should_not_relate_if_no_converter_exist()
        {
            mapping.AutoRelateEqualNames();
            Assert.Equal(0,mapping.Relations.Count);
        }

        [Fact]
        public void Should_relate_if_converter_exist()
        {
            mapping.AddConverter(Converting.BetweenIntAndString());
            mapping.AutoRelateEqualNames();
            Assert.Equal(1, mapping.Relations.Count);
        }
    }
}